<?php

namespace apiend\modules\download\controllers;

use Yii;
use apiend\components\Controller;
use apiend\modules\download\models\OrderDeliverySearch;
use common\components\office\grid\GridExcel;

/**
 * 订单信息相关下载接口
 * 
 * @author emhome <emhome@163.com>
 * @since 2.0
 */
class TestController extends Controller {

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            '*' => ['GET', 'POST'],
        ];
    }

    /**
     * 待发货订单
     * @inheritdoc
     */
    public function actionIndex() {
        $model = new OrderDeliverySearch();
        $model->store_id = $this->storeId;
        return GridExcel::widget([
            'dataProvider' => $model->search(),
            'asAttachment' => true,
            'protection' => true,
            'security' => true,
            'title' => $model->exportTitle(),
            'filename' => $model->exportFileName(),
            'captions' => $model->exportCaptionOptions(),
            'columns' => $model->exportFields(),
        ]);
    }

}
